import React, { Component } from "react";
import Doctor from "./Son";
import ComContent from "@/pages/ClassCom/ComConent";

// 有状态组件，也叫容器组件，智能组件
export default class index extends Component {
  constructor(props) {
    super(props);
    this.state = {
      doctors: [
        {
          id: "01001",
          name: "王泽荣",
          sex: "男",
        },
        {
          id: "01002",
          name: "张嘉鑫",
          sex: "男",
        },
        {
          id: "01003",
          name: "申文慧",
          sex: "女",
        },
      ],
    };
  }


  deleteDoctor = (id) => {
    console.log(`id为${id}的医生被删除了`);
  }

  render() {
    return (
      <>
        <div>有状态组件和无状态组件</div>
        <img src={require("@/assets/imgs/logo512.png")} alt="" />
        <ul>
          {this.state.doctors.map(item=>(
              <Doctor {...item} deleteDoctor={this.deleteDoctor} ></Doctor>
          ))}
        </ul>
        <hr/>
        <ComContent></ComContent>
      </>
    );
  }
}
